You are here: Symbol Reference > Dew Namespace > Dew.Signal Namespace > Dew.Signal.Units Namespace > Classes > SignalUtils Class > SignalUtils Methods > SignalUtils.Hilbert Method
Dew Signal for .NET
ContentsIndexHome
PreviousUpNext
SignalUtils.Hilbert Method

Applies hilbert transform to Src.

Syntax
C#
Visual Basic
public static TVec Hilbert([In] TVec SrcDst);

Applies hilbert transform to Src. Src must be real signal. The result is complex. Hilbert transform generates a 90 degree phase shifted version of the original. This becomes the imaginary part of the complex signal. This routine is very usefull for single block processing, but can not be used for streaming data. Use a digital FIR filter based hilbert transformer for streaming data or resort to quadrature sampling techniques [1], p. 297. 

References:  

[1] Understanding digital signal processing. Richard G. Lyons, Prentice-Hall, 2001.

Hilbert transform of a sine signal is computed for two cases:

  • frequency of the sine falls exactly on the spectral bin (ideal case)
  • frequency of the sine is not alligned with the frequency spectrum grid.
using Dew.Math; using Dew.Math.Units; using Dew.Signal; using Dew.Signal.Units; using Dew.Math.Tee; using Dew.Math.Editors; using Dew.Signal.Tee; private void button1_Click(object sender, EventArgs e) { Vector h = MtxExpr.Sin(MtxExpr.Ramp(256, TMtxFloatPrecision.mvDouble, 0, 2 * Math387.PI * 6/256)); Vector Re = new Vector(0); Vector Im = new Vector(0); Vector h1 = new Vector(0); SignalUtils.Hilbert(h); h.CplxToReal(Re, Im); MtxVecTee.DrawIt(new TVec[2] {Re,Im}, new string[2] {"Real","Imag"} ,"Integer frequency",false); h1.SetIt(false,new double[1] {Re.DotProd(Im)}); MtxVecEdit.ViewValues(h1,"Dot product between Re and Im",true); h = MtxExpr.Sin(MtxExpr.Ramp(256, TMtxFloatPrecision.mvDouble,0, 2 * Math387.PI * 6.5/256)); SignalUtils.Hilbert(h); h.CplxToReal(Re, Im); MtxVecTee.DrawIt(new TVec[2] {Re,Im}, new string[2] {"Real","Imag"} ,"Non-integer frequency",false); h1.SetIt(false,new double[1] {Re.DotProd(Im)}); MtxVecEdit.ViewValues(h1,"Dot product between Re and Im",true); h = MtxExpr.Sin(MtxExpr.Ramp(256, TMtxFloatPrecision.mvDouble, 0, 2 * Math387.PI * 6.5/256)); Re.Copy(h); Im.Copy(h); SignalUtils.KaiserImpulse(h1,new double[2] {0.95,1}, 0.01, TFilterType.ftHilbertIII,1,2,true); //Or use remez: OptimalFIR.RemezImpulse(h1,new double[2] {0.05,0.95}, 0.01, TFilterType.ftHilbertIII); SignalUtils.FirFilter(Im,h1,1,1); //also compensates for integer filter delay (if filter is Odd length (type III)) MtxVecTee.DrawIt(new TVec[2] {Re,Im}, new string[2] {"Real","Imag"} ,"With FIR Filter",false); h1.SetIt(false,new double[1] {Re.DotProd(Im)}); //dot product between Re and Im should be zero MtxVecEdit.ViewValues(h1, "Dot product between Re and Im", true); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!